<template>
	<view>
		<an-nav-bar title="技师广场" :navHeight="false" :isBg="isBg"> </an-nav-bar>
		<view class="back" :style="{'background-image': `url(${$common.binImage(technicianDetail.headImg)})`}"></view>
		<view class="content">
			<view class="top">
				<view class="info flex">
					<view class="left">
						<view class="avatar">
							<image :src="$common.binImage(technicianDetail.headImg)" mode=""></image>
							<i>真人头像认证</i>
						</view>
						<view class="name">{{technicianDetail.nickName}}</view>
						<view class="genderAndCity flex">
							<view class="gender flex_center">
								<i :class="[technicianDetail.sex == 0 ? 't0':'t1']"></i>
								<view class="t2">{{technicianDetail.age || 18}}</view>
							</view>
							<view class="realname flex_center">实名认证</view>
							<view class="city flex_center">
								<text>{{technicianDetail.city || '未设置'}}</text>
							</view>
						</view>
					</view>
					<view class="right">
						<!-- <button @click="$refs.refWecatAccount.open()">查看微信</button> -->
						<button class="gift flex_center" @click="$refs.refGift.init()">送礼</button>
					</view>
				</view>
			</view>
			<view class="infoCenter">
				<view class="albums">
					<view class="title">相册展示</view>
					<view class="photos flex">
						<view class="img" v-for="(src,idx) in technicianDetail.recentPhoto" :key="idx" @click="$common.previewImage(technicianDetail.recentPhoto,idx)">
							<image :src="$common.binImage(src)" mode=""></image>
						</view>
					</view>
				</view>
				<view class="box">
					<view class="line flex category">
						<view class="label">岗位</view>
						<view class="right flex">
							<text>{{technicianDetail.jobTitle}}</text>
						</view>
					</view>
					<view class="line flex personality">
						<view class="label">个性标签</view>
						<view class="right flex">
							<text v-for="(lab,i) in technicianDetail.personLabel" :key="i">{{lab}}</text>
						</view>
					</view>
				</view>
				<view class="box"></view>
			</view>
			<view class="bottom flex_center"></view>
		</view>
		
		<Gift :technicianId="technicianDetail.id" ref="refGift" />
		
		<!-- 查看微信 -->
		<uni-popup type="bottom" ref="refWecatAccount">
			<view class="popup-bottom">
				<view class="popup-bottom_title">微信号</view>
				<view style="padding: 60rpx 0; font-size: 30rpx;">{{technicianDetail.wecatAccount}}</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	import Gift from "@/components/gift";

	export default {
		components: {
			Gift
		},
		data() {
			return {
				isBg: false,
				technicianDetail: {},
			};
		},
		onLoad(option) {
			this.$http.get('/appNoAuth/store/massageTechnician/getInfo/' + option.id).then(res => {
				if (res.massageTechnician && res.massageTechnician.recentPhoto) {
					res.massageTechnician.recentPhoto = res.massageTechnician.recentPhoto.split(',')
				}
				if (res.massageTechnician && res.massageTechnician.personLabel) {
					res.massageTechnician.personLabel = res.massageTechnician.personLabel.split(',')
				}
				
				this.technicianDetail = res.massageTechnician
			})
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		position: relative;
		z-index: 9;
		padding-top: 88rpx 0 120rpx;

		.infoCenter {
			.box {
				border-bottom: 10rpx solid #f8f8f8;
				padding: 0 30rpx;
				background: #fff;
				overflow: hidden;

				.line {
					min-height: 100rpx;
					border-bottom: 2rpx solid #eee;
					box-sizing: border-box;
					padding: 10rpx 0;

					.label {
						color: #666;
						font-size: 30rpx;
						width: 200rpx;
					}

					&:last-child {
						border: none;
					}
				}

				.right {
					flex: 1;
					flex-wrap: wrap;
				}

				.category>.right>text {
					display: block;
					width: 110rpx;
					height: 52rpx;
					line-height: 52rpx;
					background: #eee;
					border-radius: 26rpx;
					text-align: center;
					color: #999;
					font-size: 26rpx;
					margin-right: 20rpx;
				}

				.personality>.right>text {
					display: flex;
					align-items: center;
					justify-content: center;
					box-sizing: border-box;
					min-width: 130rpx;
					height: 52rpx;
					border-radius: 52rpx;
					border: 1px solid #aa8050;
					color: #aa8050;
					font-size: 26rpx;
					margin: 10rpx 20rpx 10rpx 0;
					white-space: nowrap;
					padding: 0 8rpx;
				}
			}

			.albums {
				padding: 0 30rpx;
				background: #fff;
				border-bottom: 10rpx solid #f8f8f8;
				position: relative;

				.title {
					color: #333;
					font-size: 30rpx;
					white-space: nowrap;
					padding-top: 10rpx;
				}

				.photos {
					padding: 10rpx 0 24rpx;
					flex-wrap: wrap;

					.img {
						width: 216rpx;
						height: 216rpx;
						position: relative;
						border-radius: 10rpx;
						overflow: hidden;
						margin-right: 20rpx;
						margin-bottom: 20rpx;

						image {
							width: 216rpx;
							height: 216rpx;
							border-radius: 10rpx;
						}

						&:nth-child(3n + 3) {
							margin-right: 0rpx;
						}
					}
				}
			}
		}

		.top {
			padding: 0 15px;

			.info {
				height: 750rpx;
				align-items: flex-end !important;

				.left {
					flex: 1;
					padding-bottom: 34rpx;

					.genderAndCity {
						padding: 20rpx 0 34rpx;
						color:#fff;

						.city {
							color: #333;
							font-size: 30rpx;
							width: 140rpx;
							height: 44rpx;
							background: hsla(0, 0%, 100%, .3);
							border-radius: 8rpx;
							margin-left: 10rpx;

							&::before {
								content: "";
								display: block;
								width: 28rpx;
								height: 34rpx;
								background: url(/static/weizhi.png) no-repeat 50%;
								background-size: 100% auto;
								margin-right: 10rpx;
							}
						}

						.realname {
							/* color: #fff; */
							width: 124rpx;
							height: 44rpx;
							line-height: 44rpx;
							background: linear-gradient(90deg, #d7b075, #aa8050);
							border-radius: 8rpx;
							font-size: 26rpx;
						}

						.gender {
							color: #fff;
							width: 100rpx;
							height: 44rpx;
							background: linear-gradient(90deg, #d7b075, #aa8050);
							border-radius: 8rpx;
							margin-right: 10rpx;
							font-size: 28rpx;

							.t1 {
								display: block;
								width: 26rpx;
								height: 26rpx;
								margin-right: 8rpx;
								background: url(/static/sex1.png) no-repeat 50%;
								background-size: 100% auto;
							}

							.t0 {
								display: block;
								width: 26rpx;
								height: 26rpx;
								margin-right: 8rpx;
								background: url(/static/sex0.png) no-repeat 50%;
								background-size: 100% auto;
							}

							.t2 {
								font-weight: 400;
							}
						}
					}

					.name {
						height: 60rpx;
						line-height: 60rpx;
						display: inline-block;
						min-width: 220rpx;
						text-align: center;
						color: #000;
						font-size: 50rpx;
					}

					.avatar {
						width: 220rpx;
						height: 220rpx;
						margin-bottom: 16rpx;
						position: relative;

						image {
							width: 220rpx;
							height: 220rpx;
							border-radius: 50%;
						}

						i {
							display: block;
							width: 160rpx;
							height: 36rpx;
							background: #f7b500;
							border-radius: 18rpx;
							color: #fff;
							font-size: 11px;
							text-align: center;
							position: absolute;
							left: 50%;
							-webkit-transform: translateX(-50%);
							transform: translateX(-50%);
							bottom: 0;
						}
					}
				}

				.right {
					padding-bottom: 66rpx;

					.gift::before {
						content: "";
						display: block;
						width: 30rpx;
						height: 32rpx;
						background-size: 100% auto;
						background: url(/static/gift.png) no-repeat 50%;
						margin-right: 10rpx;
					}

					button {
						width: 170rpx;
						height: 70rpx;
						line-height: 70rpx;
						background: linear-gradient(90deg, #d7b075, #aa8050);
						border-radius: 40rpx;
						color: #fff;
						margin-bottom: 32rpx;
						font-size: 28rpx;

						&::after {
							border: none;
						}
					}
				}
			}
		}
	}

	.back {
		width: 100%;
		height: 750rpx;
		background-repeat: no-repeat;
		background-size: 100% auto;
		background-position: top;
		filter: blur(4px);
		position: fixed;
		top: 0;
		left: 0;
		z-index: 0;

	}
</style>
